package com.mxx.v3.web.controller;

import com.github.pagehelper.PageInfo;
import com.mxx.v3.dto.QualityMouthUnqualifiedDto;
import com.mxx.v3.pojo.TQualityMouthQualified;
import com.mxx.v3.service.QualityMouthUnqualifiedService;
import com.mxx.v3.support.RestResponse;
import com.mxx.v3.utils.PageDto;
import com.mxx.v3.utils.PageQuery;
import com.mxx.v3.web.query.QualityMouthUnqualifiedQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/qualitymouthunqualified")
public class QualityMouthUnqualifiedController {
    @Autowired
    private QualityMouthUnqualifiedService qualityMouthUnqualifiedService;
    @GetMapping("/list")
    public RestResponse getList(Integer page, Integer limit, QualityMouthUnqualifiedQuery qualityMouthUnqualifiedQuery){
        PageQuery<QualityMouthUnqualifiedQuery> aualityMouthUnQualifiedPageQuery=new PageQuery<>();
        aualityMouthUnQualifiedPageQuery.setLimit(limit);
        aualityMouthUnQualifiedPageQuery.setPage(page);
        aualityMouthUnQualifiedPageQuery.setQueryItem(qualityMouthUnqualifiedQuery);
        //查询除数据
        PageInfo<QualityMouthUnqualifiedDto> pageInfo=qualityMouthUnqualifiedService.getData(aualityMouthUnQualifiedPageQuery);
        PageDto<QualityMouthUnqualifiedDto> data= new PageDto<>(pageInfo.getTotal(), pageInfo.getList());
        return new RestResponse(data);
    }
}
